# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=csview
pkgver=1.3.0
pkgrel=0
pkgdesc="Pretty csv viewer for cli with cjk/emoji support"
url="https://github.com/wfxr/csview"
arch="all"
license="Apache-2.0 OR MIT"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/wfxr/csview/archive/v$pkgver/csview-$pkgver.tar.gz"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/

	install -D -m644 completions/bash/$pkgname.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname

	install -D -m644 completions/fish/* -t "$pkgdir"/usr/share/fish/vendor_completions.d/
	install -D -m644 completions/zsh/* -t "$pkgdir"/usr/share/zsh/site-functions/
}

sha512sums="
6ca060089a4cbf20a46a0f9e23d8f38b2366a88e0fd6054b40cd1532615164330829201c776d1e14b35f354e8bc4ca0ba8825e835ce3f62a0faae2714d3a8a18  csview-1.3.0.tar.gz
"
